<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">

<div th:fragment="pagination(url)">
    <ul class="pagination">
        <li><a href="">&laquo;</a></li>

        <li>
            <a th:if="${not pageInfo.isFirstPage}" th:href="@{${url}(pageNum=${pageInfo.pageNum-1},pageSize=${pageInfo.pageSize})}">上一页</a>
            <a th:if="${pageInfo.isFirstPage}" href="javascript:void(0);">上一页</a>
        </li>

        <li th:each="pageNo : ${#numbers.sequence(1, pageInfo.pages)}">
            <a th:if="${pageInfo.pageNum eq pageNo}" href="javascript:void(0);">
                <span th:text="${pageNo}"></span>
            </a>

            <a th:if="${not (pageInfo.pageNum eq pageNo)}" th:href="@{${url}(pageNum=${pageNo},pageSize=${pageInfo.pageSize})}">
                <span th:text="${pageNo}"></span>
            </a>
        </li>
        <li>
            <a th:if="${not pageInfo.isLastPage}" th:href="@{${url}(pageNum=${pageInfo.pageNum+1},pageSize=${pageInfo.pageSize})}">下一页</a>
            <a th:if="${pageInfo.isLastPage}" href="javascript:void(0);">下一页</a>
        </li>

        <li><a href="#">&raquo;</a></li>
    </ul>
</div>